package kuangshen.join;

/**
 * @program: liangt
 * @description: 插队
 * @author: liangt
 * @create: 2021-03-03 13:09
 */
public class TestJOIN {

    public static void main(String[] args) {

        MyJoin myJoin = new MyJoin();

        Thread thread = new Thread(myJoin);

        thread.start();

        for (int i = 0; i < 1000; i++) {
            if (i == 200){
                try {
                    thread.join();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            System.out.println("Main :" + i);
        }
    }
}

class MyJoin implements Runnable {
    @Override
    public void run() {
        for (int i = 0; i < 100; i++){
            System.out.println("VIP来了 ："+ i );
        }
    }
}